﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace KALE_Scanning {
    public partial class ChoiceForm : Form {
        string url;
        AGC_WebServices.Control fieldForControl;
        public ChoiceForm(AGC_WebServices.Control fieldForControl,string url) {
            InitializeComponent();
            label1.Text = fieldForControl.Isim + ":";
            this.url = url;
            this.fieldForControl = fieldForControl;
        }

        private void button1_Click(object sender, EventArgs e) {
            using (AGC_WebServices.Service ws = new AGC_WebServices.Service()) {
                ws.UseDefaultCredentials = true;
                string text = textBox1.Text.Trim();
                string fieldChoiceId = fieldForControl.FieldID.ToString();
                ws.InsertChoiceColumn(url, fieldChoiceId, text);
                this.DialogResult = DialogResult.OK;
                Utility.NewChoiceValue = text;
                Close();
            }

        }

        
    }
}
